package WaiBao;

import java.util.Arrays;

public class PengWenQi {
    public static void main(String[] args) {
        String[] name = {"图灵(班长)", "冯诺依曼(副班长)", "小李(学习委员)", "李伟(体育委员)", "王大夫", "梁家辉", "李学堂", "王志义", "张村发", "张海", "吴郑宇", "乔布斯",
                "马克龙", "安倍晋三", "奥巴马", "特朗普", "吴奇隆", "迪奥", "李忠祥", "张家峰", "乐凯", "海底捞", "王嘉维", "李大虎", "倪大红", "张胖子", "李子光", "王子轩",
                "谢霆锋", "彭文琦(学生)"};//考生本人:彭文琦(学生)
        int[] age = {20,19, 21, 22, 22,21, 18, 18, 19, 21, 18, 19, 21, 22, 21, 19, 18, 19, 18, 20, 19, 19, 20, 20, 21, 18, 20,20, 21, 20};//考生年龄：20

        double[] haodong1 = {90, 80, 64, 90, 70, 69, 78, 89, 81, 90, 98, 87, 55, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 88, 78, 82, 95};
        double[] haodong2 = {80, 75, 69, 96, 80, 77, 82, 79, 90, 91, 60, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 72, 61, 91, 95};
        double[] haodong3 = {68, 90, 60, 55, 75, 69, 78, 89, 80, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 78, 61, 85, 90};


        double yangkia1;//代表每个学生的总分
        double yangkia2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            yangkia1 = haodong1[i] + haodong2[i] +haodong3[i];
//            yangkia2 = ( yangkia1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + yangkia1);
//            System.out.println(name[i] + "的平均分为:" +yangkia2);
//        }

        double zhienng = 0, dulu = 0;
        double[] mubapei = new double[30];
//        for (int i = 0; i < 30; i++) {
//            zhienng  = haodong1[i] + haodong2[i] +haodong3[i];
//            dulu = (zhienng  * 1.0) / 3;
//            mubapei[i] = dulu;
//        }
//
//        for (int i = 0; i < mubapei.length - 1; i++) {
//            for (int j = 0; j < mubapei.length - i - 1; j++) {
//                if (mubapei[j] < mubapei[j + 1]) {
//                    double tep = mubapei[j];
//                    mubapei[j] =mubapei[j + 1];
//                    mubapei[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(mubapei[i]);
//        }


        double jilu1 = 0,jilu2 = 0, jilu3 = 0;//计算每门课的平均分
        double cluo1 = 0,cluo2 = 0, cluo3 = 0;//计算每门课标准差
        double ben1 = 0, ben2 = 0, ben3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < haodong1.length; i++) {
            sum2+=haodong1[i];
        }
        jilu1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+jilu1);
        double Sum = 0;
        for (int i = 0; i < haodong2.length; i++) {
            Sum+=haodong2[i];
        }
        jilu2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+jilu2);
        double sum = 0;
        for (int i = 0; i <haodong3.length; i++) {
            sum+=haodong3[i];
        }
        jilu3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+jilu3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <haodong1.length; i++) {
            c1+= (haodong1[i] -jilu1)*(haodong1[i] - jilu1);
        }
        cluo1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+cluo1);

        for (int i = 0; i < haodong2.length; i++) {
            c2+= (haodong2[i] - jilu2)*(haodong2[i] - jilu2);
        }
        cluo2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+cluo2);

        for (int i = 0; i < haodong3.length; i++) {
            c3+= (haodong3[i] -jilu3)*(haodong3[i] - jilu3);
        }
        cluo3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+cluo3);
//////
//////
        Arrays.sort(haodong1);
        Arrays.sort(haodong2);
        Arrays.sort(haodong3);
        ben1 =( haodong1[14]+haodong1[15])*1.0/2;
        ben2 =( haodong2[14]+haodong2[15])*1.0/2;
        ben3 =( haodong3[14]+haodong3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+ben1);
        System.out.println("微生物学的中位数为:"+ben2);
        System.out.println("人体组织解剖学的中位数为:"+ben3);



    }
}
